<template>
	<view>
		<view class="home_swiper">
			<swiper class="ad-swiper" indicator-dots="true" indicator-color="rgba(228,228,228,1)"
				indicator-active-color="#FECA49" autoplay="true" interval="5000" duration="1000" circular="true">
				<block v-for="(item, index) in ad" :key="index" @click="_advertJump(item)">
					<swiper-item>
						<image style="height:100%;width: 100%" :src="item.url"></image>
					</swiper-item>
				</block>
			</swiper>
			<!-- <vc-ads :height="300" locationTypeCd="5000"></vc-ads> -->
		</view>
	</view>
</template>

<script>
	import {
		getActivitiTitle,
		getCategoryList,
		loadActivites,
		// loadAdverts
	} from '../../api/index/indexApi.js'
	export default {
		name: "indexAds",
		data() {
			return {
				banner: [{
						url:''
					},
					{
						url:''
					}
				],
				ad: [
					{
							url:''
						},
						{
							url:''
						}
				],
			};
		},
		created() {
			// this._loadAdvertPhoto();
		},
		methods: {
			_advertJump: function(ad) {
				if (ad.advertType == 3 || !ad.pageUrl) {
					return;
				}
				if (ad.advertType == 2) {
					// 站外
					let url = encodeURIComponent(ad.pageUrl)
					uni.navigateTo({
						url: '/pages/hcWebView/hcWebView?url=' + url
					})
					return;
				}
				if (ad.advertType == 1) {
					// 站内
					uni.navigateTo({
						url: ad.pageUrl
					})
					return;
				}
			},
		}
	}
</script>

<style lang="scss">
	.home_swiper {
		margin-bottom: 10rpx;
		.ad-swiper {
			border-bottom: 20rpx solid #191b1f;
		}
	}
</style>
